package com.cangxuan.blockchain.bean;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 接口返回结果
 */
@Data
public class Result implements Serializable {

    private int status;      //状态
    private String message; //响应消息
    private Object value;   //响应的数据体
    private long timestamp; //当时时间

    public Result(int status, String message) {
        this.status = status;
        this.message = message;
        timestamp = System.currentTimeMillis();
    }

    public Result(int status, Object value) {
        this.status = status;
        this.value = value;
        timestamp = System.currentTimeMillis();
    }

    public Result(int status, String message, Object value) {
        this.status = status;
        this.message = message;
        this.value = value;
        timestamp = System.currentTimeMillis();
    }
}
